#ifndef __RD522_IF_H
#define __RD522_IF_H

#include "stm32f0xx.h"
#define ZKRD522_SPI_Mode
#define u8 uint8_t

// IRQ中断，即ZKRD522模块的IRQ引脚，使用外部中断
#define               ZKRD522_GPIO_IRQ_CLK_FUN                RCC_AHBPeriphClockCmd
#define               ZKRD522_GPIO_IRQ_CLK                    RCC_AHBPeriph_GPIOB
#define               ZKRD522_GPIO_IRQ_PORT    	              GPIOB
#define               ZKRD522_GPIO_IRQ_PIN                    GPIO_Pin_9
#define               ZKRD522_GPIO_IRQ_Mode		              GPIO_Mode_IN

// IRQ中断线
#define           ZKRD522_IRQ_EXTI_CLK_FUN            RCC_AHBPeriphClockCmd
#define           ZKRD522_IRQ_EXTI_CLK                RCC_AHBPeriph_AFIO
#define           ZKRD522_IRQ_EXTI_IRQ                EXTI4_15_IRQn
#define           ZKRD522_IRQ_EXTI_LINE               EXTI_Line9
#define           ZKRD522_IRQ_EXTI_PORTSOURCE         EXTI_PortSourceGPIOB
#define           ZKRD522_IRQ_EXTI_PINSOURCE          EXTI_PinSource9
#define           ZKRD522_IRQPin_IRQHandler           EXTI4_15_IRQHandler

void ZKRD522_IrqPin_Config(void);
void write_lpcd_exreg(uint8_t addr, uint8_t RegValue);
void write_buf(u8 addr, u8* data, uint32_t lenth);
uint8_t read_lpcd_exreg(uint8_t addr);
void read_buf(u8 addr, u8* data, uint32_t lenth);



#endif
